package com.service.device;

import com.dao.secondary.device.DeviceObdGpsInfoMapper;
import com.model.domain.device.GetDeviceObdGpsInfoDO;
import com.model.pojo.device.DeviceObdGpsInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * @Author: zql
 * @Description: 【请填写功能名称】服务
 * @Data: 2023-06-08
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DeviceObdGpsInfoService {
    private final DeviceObdGpsInfoMapper deviceObdGpsInfoMapper;
    public List<DeviceObdGpsInfo> getPageList(GetDeviceObdGpsInfoDO getDeviceObdGpsInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getDeviceObdGpsInfoDO.getPage(), getDeviceObdGpsInfoDO.getPageSize(), getDeviceObdGpsInfoDO.getSortRow() + getDeviceObdGpsInfoDO.getSortOrder());
        return deviceObdGpsInfoMapper.selectList(getDeviceObdGpsInfoDO);
    }

    public List<DeviceObdGpsInfo> getAllList(GetDeviceObdGpsInfoDO getDeviceObdGpsInfoDO){
        PageHelper.clearPage();
        PageHelper.orderBy(getDeviceObdGpsInfoDO.getSortRow() + getDeviceObdGpsInfoDO.getSortOrder());
        return deviceObdGpsInfoMapper.selectList(getDeviceObdGpsInfoDO);
    }

    public List<Map<String,Object>> getListGroupBy(GetDeviceObdGpsInfoDO getDeviceObdGpsInfoDO){
        return deviceObdGpsInfoMapper.selectListGroupBy(getDeviceObdGpsInfoDO);
    }

    public DeviceObdGpsInfo getById(String tableName,Long id){
        return deviceObdGpsInfoMapper.selectByPrimaryKey(tableName,id);
    }
    public int countByDtu(GetDeviceObdGpsInfoDO getDeviceObdGpsInfoDO){
        return deviceObdGpsInfoMapper.countByDtu(getDeviceObdGpsInfoDO);
    }
}
